/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */

package cn.webrx;

import java.io.FileInputStream;
import java.io.FileOutputStream;

/**
 * <p>Project: jse2303 - Stream4
 * <p>Powered by webrx On 2023-07-21 11:34:58
 * <p>描述：<p>
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Stream4 {
    public static void main(String[] args) {
        //实现文件复制
        String src = "d:/sys.rar";
        String dst = "d:/sys2.rar";
        try (var fis = new FileInputStream(src); var fos = new FileOutputStream(dst);) {
            long ss = System.currentTimeMillis();

            byte[] buf = new byte[102400];
            int len = 0;
            while ((len = fis.read(buf)) > 0) {
                fos.write(buf, 0, len);
            }

            //fis.transferTo(fos);
            long ee = System.currentTimeMillis();

            System.out.println(ee - ss);

        } catch (Exception e) {

        }
    }
}
